package com.visikard.response;

import org.json.JSONException;
import org.json.JSONObject;

import com.visikard.item.StaffAccountObj;

public class StaffLoginResponse extends BaseResponse {

	public static final int ERROR_INVALID_REGISTERED_EMAIL_ADDRESS = BaseResponse.USER_DEFINED_ERROR;
	public static final int ERROR_INVALID_MERCHANT_CODE = BaseResponse.USER_DEFINED_ERROR - 1;
	public static final int ERROR_INVALID_STORE_CODE = BaseResponse.USER_DEFINED_ERROR - 2;
	public static final int ERROR_WRONG_PIN = BaseResponse.USER_DEFINED_ERROR - 3;

	private StaffAccountObj account;

	public StaffLoginResponse() {
		super();
	}

	public StaffAccountObj getAccount() {
		return account;
	}

	public void setAccount(StaffAccountObj account) {
		this.account = account;
	}

	@Override
	public void extractDataFromServer(String response) throws JSONException {
		super.extractDataFromServer(response);

		if (errorCode == SUCCESS) {
			JSONObject jDataObj = getDataJObject(response);
			account = new StaffAccountObj(jDataObj);
		}
	}

}
